/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.biz.entity;

import org.hibernate.validator.constraints.Length;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 订单表Entity
 * @author Lai_Hanzhang
 * @version 2019-03-13
 */
@Table(name="biz_order_child", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="sort", attrName="sort", label="排序号"),
		@Column(name="parent_id", attrName="parent.id", label="父级id"),
		@Column(name="goods_id", attrName="bizGoods.goodsId", label="商品id"),
		@Column(name="unit", attrName="unit", label="单位"),
		@Column(name="quantity", attrName="quantity", label="数量"),
		@Column(name="create_by", attrName="createBy", label="创建人", isUpdate=false, isQuery=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false),
		@Column(name="update_by", attrName="updateBy", label="更新人", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false),
		@Column(name="remarks", attrName="remarks", label="备注", queryType=QueryType.LIKE),
	},joinTable={
		@JoinTable(type=Type.LEFT_JOIN, entity=BizGoods.class, alias="g", 
	    on="g.goods_id = a.goods_id",
	    columns={
	    	@Column(name="goods_id", label="商品编号", isPK=true),
		    @Column(name="goods_name",label="商品名称"),
	    })
    },	
    orderBy="a.create_date ASC"
)
public class BizOrderChild extends DataEntity<BizOrderChild> {
	
	private static final long serialVersionUID = 1L;
	private Long sort;		// 排序号
	private BizOrder parent;		// 父级id 父类
	private BizGoods bizGoods;		// 商品id
	private String unit;		// 单位
	private Double quantity;		// 数量
	
	public BizOrderChild() {
		this(null);
	}


	public BizOrderChild(BizOrder parent){
		this.parent = parent;
	}
	
	public Long getSort() {
		return sort;
	}

	public void setSort(Long sort) {
		this.sort = sort;
	}
	
	@Length(min=0, max=64, message="父级id长度不能超过 64 个字符")
	public BizOrder getParent() {
		return parent;
	}

	public void setParent(BizOrder parent) {
		this.parent = parent;
	}
	
	@Length(min=0, max=64, message="商品id长度不能超过 64 个字符")
	public BizGoods getBizGoods() {
		return bizGoods;
	}


	public void setBizGoods(BizGoods bizGoods) {
		this.bizGoods = bizGoods;
	}
	
	@Length(min=0, max=500, message="单位长度不能超过 500 个字符")
	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}
	
	public Double getQuantity() {
		return quantity;
	}

	public void setQuantity(Double quantity) {
		this.quantity = quantity;
	}
	
}